//
//  Grid.cpp
//  warehousekeeper
//
//  Created by Fernando Torres on 18/08/12.
//  Copyright (c) 2012 Fernando Torres. All rights reserved.
//

#include "Grid.h"

Grid::Grid():
m_wall('#'),
m_player('@'),
m_playerOnGoalSquare('+'),
m_box('$'),
m_boxOnSquare('*'),
m_goalSquare('.'),
m_floor(' ')
{
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
    
    m_grid.push_back(m_wall);
    m_grid.push_back(m_player);
    m_grid.push_back(m_box);
    m_grid.push_back(m_goalSquare);
    m_grid.push_back(m_wall);
    
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
    m_grid.push_back(m_wall);
}

void Grid::drawGrid()
{
    for(unsigned int i = 1; i < 15; i++)
    {
        if(i%5 != 0)
        {
            std::cout << m_grid[i];
        }
        else
        {
            std::cout << std::endl;
        }
    }
}

void Grid::setGrid(std::vector<char> gridToSet)
{
    m_grid = gridToSet;
}

void Grid::setElement(char element, unsigned int x, unsigned int y)
{
    m_grid[x + y*5] = element;
}

